package com.example.the_breakfast_club;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

/**
 * Screen for account registration.
 * @author Team 19
 */
public class RegisterActivity extends Activity {

	private DatabaseHandler db;
	
	/**
	 * Constructor for any activity.
	 * @param savedInstanceState, retained state information
	 */
	@SuppressLint("NewApi")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//Get email from Login screen
		Intent intent = getIntent();
		String mEmail = intent.getStringExtra(LoginActivity.EXTRA_MESSAGE);
		
		setContentView(R.layout.activity_register);
		
		db = DatabaseHandler.getInstance(this);
		
		TextView mEmailView = (TextView) findViewById(R.id.RegEmail);
		mEmailView.setText(mEmail);
		
		mEmail = getIntent().getStringExtra("Default");
		EditText mName = (EditText) findViewById(R.id.regName);
		//mName.setText("Full Name");
		mName.setText(mEmail);
		
		findViewById(R.id.bSubmit).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						Intent intent = new Intent(RegisterActivity.this, ResultsActivity.class);
				        RegisterActivity.this.startActivity(intent);
					}
				});
	}

	/**
	 * Inflates the specified menu. 
	 * Initializes the contents of the Activity's standard options menu.
	 * @param menu, menu to be inflated
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_register, menu);
		return true;
	}
}
